const { merge } = require("webpack-merge");

const baseConfig = require("./webpack.base");

const devConfig = {
  mode: "development",
  devtool: "eval-cheap-module-source-map",
  output: {
    filename: "[name].js",
  },
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: ["style-loader", "css-loader"],
      },
    ],
  },
  devServer: {
    static: "./dist",
    port: 3300,
    proxy: {
      "/api": {
        target: "http://study.jsplusplus.com/",
        changeOrigin: true,
        pathRewrite: {
          "^/api": "",
        },
      },
    },
  },
};

module.exports = merge(baseConfig, devConfig);
